import React from 'react'
import Alert from '@material-ui/lab/Alert';
import { connect } from 'react-redux'
import './falert.less'

function FAlert(props) {
  return (
    <div className="f-alert" style={{ display: props.isAlerting ? 'flex' : 'none' }}>
      <Alert variant="filled" severity={props.alertType}>{props.alertingMsg}</Alert>
    </div>
  )
}

const mapStateToProps = (state) => {
  return {
    isAlerting : state.isAlerting,
    alertType : state.alertType,
    alertingMsg : state.alertingMsg
  }
}

export default connect(mapStateToProps)(FAlert)
